package com.accompany.adapter;

import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.accompany.fragment.order.CompleteFragment;
import com.accompany.fragment.order.ObligationOrderFragment;
import com.accompany.fragment.order.OrderAllFragment;
import com.accompany.fragment.order.TobeServedFragment;

import java.util.List;

/**
 * 信息说明:
 * company: 兰州丰荣信息科技有限公司
 * 创建时间: on 2022/3/15 16 ：13
 * 项目名称：yuanban
 */
public class OrderListAdapter extends FragmentPagerAdapter {
    private List<Fragment> fmList;

    public OrderListAdapter(FragmentManager fragmentManager, List<Fragment> list) {
        super(fragmentManager);
        fmList = list;
    }
    @Override
    public Fragment getItem(int arg0) {
        if (arg0 == 0) {
            return new OrderAllFragment();
        } else if (arg0 == 1) {
            return new ObligationOrderFragment();
        } else if (arg0 == 2) {
            return new TobeServedFragment();
        } else if (arg0 == 3) {
             return new CompleteFragment();
        }
        return null;
    }
    @Override
    public int getCount() {
        return fmList.size();
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {}
}

